<?php
require_once('configure.php');
$data_id = isset($_GET['_value']) ? (int) $_GET['_value'] : 0 ;
$query ="SELECT * FROM kompetensi WHERE kompetensi_unit_id =". $data_id;
 
$datas = array();
$res = my_query($query);
$datas[] = array(0 =>'');
while( $re =my_fetch_array($res )){
	$len = $re['nama_kompetensi'];
	if( strlen($len) >  65 ) 
	$datas[] = array($re['kompetensi_id'] => substr($re['nama_kompetensi'] ,0 ,  65)." ..." ); 
	else
	$datas[] = array($re['kompetensi_id'] =>   $re['nama_kompetensi']  ); 
}
if($data_id  == 0) 
	$datas[] = array( 0 => 'Silakan pilih unit kompetensi');

 
	echo json_encode( $datas );

?>